<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>邮件发送</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="">
		<link rel="stylesheet" type="text/css" href="../../css/counter.css">
		<link rel="stylesheet" type="text/css" href="../../css/css.css">
		<script type="text/javascript" src="../../javascript/common.js"></script>
		<script type="text/javascript" src="../../javascript/jquery.js"></script>
	    <style >
		#spanAddFile{
		cursor:hand;
		color:blue;
		font-size:12px;
		}
		.removeFile{
		cursor:hand;
		color:blue;
		font-size:12px;
		}
	   .filec{
	   border:1px #cccccc solid;
	   
	   }
		</style>
		<script type="text/javascript">
      $(function(){
      $("#close1").click(function(){
      $("#search_1").hide("slow");
	  })
     $("#selectSendren").click(function(){
      $("#search_1").show("slow");
	  })
      $("#selectEmailp").click(function(){
      $("#search_1").hide("slow");
	  var text=$("input[@type='radio'][@checked]").val();
	// var array=text.split("|");
      $("#emailaddr").attr("value",$.trim(text));
     })
     //=============收件人取出
      $("#selectReRen").click(function(){
      $("#search_2").show("slow");
      $("#search_div3").show("slow");
	  })
      $("#selectrEmailp").click(function(){
      $("#search_2").hide("slow");
      $("#search_div3").hide("slow");
      //设置收件人地址
	   var text=$("input[@type='checkbox'][@checked]").val();
	    var eStr="";
	   $('input[@type="checkbox"][@checked]').each(function(){
       if($(this).val()!='null'&&$(this).val()!=""){
         eStr=eStr+$(this).val()+",";
       }
       });
	  $("#receive").attr("value",eStr);
     })
      $("#close2").click(function(){
      $("#search_2").hide("slow");
      $("#search_div3").hide("slow");
	  })
    });
    function viewXmEmailByXkId(xkid,xkname){
    if($("#xm"+xkid).html()=="＋"){
      $("#xm"+xkid).html("－");
     //=========判断是否已查询start
     $("#loading").show("slow");
      $.ajax({ //======根据xkId异步处理取得该专业的项目start
      type: "POST",
      url: "listXmByXkId.action",
      data: "xkId="+xkid,
      dataType:"json" ,
      success:function(xxjson){ //=======返回指定学科数据
       var bimlist = xxjson.bimList;
       $("#xk"+xkid).slideToggle(800);
       $.each(bimlist,function(i){//迭代json 
       $("#xk"+xkid).append('<tr bgColor=#FFFFFF><td width="30%"><input type="checkbox"  value="'+bimlist[i].email+'"></td><td width="60%">'+bimlist[i].name+'</td><td width="30%">'+bimlist[i].email+'</td></tr>'); 
       });
       $("#loading").hide("slow");
       } ,
      error:function(msg){alert("载入错误！！ 请重试");}   
      });//======根据xkId异步处理取得该专业的项目end
     
      }else { //不等+ 
       $("#xm"+xkid).html("＋");
       $("#xk"+xkid).hide(800);
      
      }
    }
    //======根据xkId异步处理取得该专业的项目 返回函数
     function emsCheck(){ 
       $('input[@type="file"]').each(function(){
       if($(this).val()!='null'&&$(this).val()!=""){
          if(!isFileType($(this).val())){
          alert("文件类型 为.doc|.txt|.ppt|.log|.xls|.vsd|.rar|.zip|.png|.jpg|.gif|.pdf|等 ")
          }
       }
       });
    if($("#title").val()==""){alert("标题不能为空");return false;}
    if($("#emailaddr").val()==""){alert("发件人不能为空");return false;}
    if($("#password").val==""){alert("发件人密码不能为空");return false;}
    if($("#receive").val==""){alert("收件人不能为空");return false;}
    if($("#content").val==""){alert("收件人不能为空");return false;}
    
     }
    </script>

<script type="text/javascript">
function addMore()
{
	var td = document.getElementById("more");
	
	var br = document.createElement("br");
	var input = document.createElement("input");
	var button = document.createElement("input");
	
	input.type = "file";
	input.name = "msf.file";
	
	button.type = "button";
	button.value = "删除";
	button.onclick = function()
	{
		td.removeChild(br);
		td.removeChild(input);
		td.removeChild(button);
	}
	
	td.appendChild(br);
	td.appendChild(input);
	td.appendChild(button);
	
}


</script>



	</head>
	<body>

		<TABLE cellSpacing="0" cellPadding="0" width="100%" align="center"
			border="0" class="table_top">
			<TBODY>
				<TR>
					<TD>
						<IMG src="../../images/manage/arron1.gif">
						<FONT class="font_lv">发送电子邮件</FONT>
					</TD>

				</TR>
			</TBODY>
		</TABLE>
	<form action="sendMails.action"  method="post" onsubmit="return emsCheck()" enctype="multipart/form-data">
		<input type="submit" class="btn1" value="发 送" 
			class="list_button" />
		&nbsp;&nbsp;
		<input type="button" class="btn1" value="取 消"
			onclick="history.back();" class="list_button" />
		<table cellSpacing="1" cellPadding="1" width="100%" align="center"
			border="0">
			<tr>
				<td class=line>
					<table height="100%" cellSpacing=1 cellPadding=2 width="100%"
						bgcolor="#CCCCCC" border=0>
						<TBODY>
							<tr bgcolor="#FFFFFF">
								<td height="25" colspan="1" align="center"
									background="../../images/manage/title_bg.jpg"
									class="font_12_B_w">
									邮件添加
								</td>
								<td height="25" colspan="2"
									background="../../images/manage/title_bg.jpg">
									注意
									<font color="red">*</font>表示必填项；英文和数字应为半角字符
								</td>
							</tr>
							<tr bgcolor="#FFFFFF">
								<td align="right" width="20%">
									邮件标题：
								</td>
								<td width="60%">
									<s:textfield size="40" cssClass="id_kuang" id="title"
										name="msf.subject" theme="simple" maxlength="30"></s:textfield>
									&nbsp;&nbsp;30个汉字之内。
								</td>
								<td align="left" width="20%">
									<font color="red">*</font>填写邮件标题
								</td>
							</tr>
							<tr bgcolor="#FFFFFF">
								<td align="right" width="20%">
									发件人邮件地址：
								</td>
								<td width="60%">
									<s:textfield size="40" cssClass="id_kuang" id="emailaddr"
										theme="simple" name="msf.mailaddr" maxlength="30"  onblur=""/>
									<span id="selectSendren" style="cursor:hand;color:blue;">&nbsp;&nbsp;&nbsp;选择</span>&nbsp;&nbsp;&nbsp;
								</td>
								<td align="left" width="20%">
									<font color="red">*</font> 发件人邮箱。
								</td>
							</tr>
							<tr bgcolor="#FFFFFF">
								<td align="right" width="20%">
									发件人邮件密码：
								</td>
								<td width="60%">
									<s:password size="40" cssClass="id_kuang" theme="simple"
										name="msf.password" id="password" maxlength="30"></s:password>
									&nbsp;&nbsp;

								</td>
								<td align="left" width="20%">
									<font color="red">*</font>发件箱密码。
								</td>
							</tr>
							<tr bgcolor="#FFFFFF">
								<td align="right" width="20%">
									收件人邮件地址：
								</td>
								<td width="60%">
									<s:textfield size="100" cssClass="id_kuang" id="receive"
										theme="simple" name="emailsString" maxlength="30"></s:textfield>
									&nbsp;&nbsp;
									<span id="selectReRen" style="cursor:hand;color:blue;">&nbsp;&nbsp;&nbsp;选择</span>&nbsp;&nbsp;&nbsp;
								</td>
								<td align="left" width="20%">
									<font color="red">*</font>收件人邮箱
								</td>
							</tr>
								<tr bgcolor="#FFFFFF">
								<td align="right">
									附件
								</td>
								<td id="more">
				<input class="filec" style="width: 300px" name="msf.file" type="file" />
				<span id="spanAddFile" onclick="addMore()">继续添加</span>
			
		
								</td>
								<td>
									<font color="red">*附件添加</font>
								</td>
							</tr>
							<TR bgcolor="#FFFFFF">
								<td align="right">
									邮件内容：
								</td>
								<td align="center">
									<s:hidden id="content" cssClass="textarea_2"  name="msf.content"></s:hidden>
									<iframe id="myiframe"
										src="htmleditor/editor.htm?id=content&ReadCookie=0"
										frameborder="0" scrolling="no" width="626" height="460"></iframe>
								</td>
								<td>
									<font color="red">*</font>
								</td>
							</tr>
						</TBODY>
					</table>
				</td>
			</tr>
		</table>
		</form>
		<DIV id="search_1"
			style="BORDER-RIGHT: #cee6ff 1px outset; BORDER-TOP: #cee6ff 1px outset; LEFT: 30%;  display:none;  BORDER-LEFT: #cee6ff 1px outset; WIDTH: auto; BORDER-BOTTOM: #cee6ff 1px outset; POSITION: absolute; TOP: 23%; HEIGHT: auto;overflow:no; BACKGROUND-COLOR: #eeeeee">
			<TABLE cellSpacing="1" cellPadding="0" width="100%" bgColor="#cee6ff"
				border="0">
				<TBODY>
					<TR>
						<TD width=240>
							<IMG src="../../images/manage/arron1.gif">
							<FONT class="font_12_B_w">发件人列表</FONT>
						</TD>
						<TD align=right>
							<span id="close1" style="cursor:pointer;">X</span>
						</TD>
					</TR>
				</TBODY>
			</TABLE>
			<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
				<tr>
					<td>
						<TABLE cellSpacing="1" cellPadding="1" width="100%" border="0">
							<TR>
								<TD class=line>
									<table height="100%" cellSpacing=1 cellPadding=2 width="100%"
										bgColor=#CCCCCC border=0>

										<s:iterator value="pm.datas" id="bil" status="b">
											<tr bgColor=#FFFFFF>
												<td width="3%" align="center">
													<input type="radio" name="emailaddr" value="${emailaddr}">
												</td>
												<td width="16%" align="center">
													<s:property value="name" />
												</td>
												<td width="20%">
													<s:property value="emailaddr" />
												<td width="8%">
												</td>
												<td width="11%">
													<s:property value="stmp" />
												</td>
												<td width="13%" align="center">
													--
												</td>
											</tr>
										</s:iterator>
										<tr bgColor=#FFFFFF>
											<td colspan="6">
												<input type="button" class="id_kuang" id="selectEmailp"
													value="确认">
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</DIV>
		<DIV id="search_2"
			style="BORDER-RIGHT: #cee6ff 1px outset; BORDER-TOP: #cee6ff 1px outset; LEFT: 30%;display:none;scrollbar-face-color:#5094C0;scrollbar-shadow-color: #3D5054;
BORDER-LEFT: #cee6ff 1px outset; WIDTH: auto; BORDER-BOTTOM: #cee6ff 1px outset; POSITION: absolute; TOP:10%; HEIGHT: 288px; BACKGROUND-COLOR: #eeeeee">
			<TABLE cellSpacing="1" cellPadding="0" width="100%" bgColor="#cee6ff"
				border="0">
				<TBODY>
					<TR>
						<TD width=240 height="20">
							<IMG src="../../images/manage/arron1.gif">
							<FONT class="font_12_B_w">收件人列表</FONT>&nbsp;&nbsp;<div id="loading" style="display:none"><img src="../../images/manage/load2.gif" height="15" width="15"></img>loading...</div>
						</TD>
						<TD align=right>
							<span id="close2" style="cursor:pointer;"><font
								color="red">X</font>
							</span>
						</TD>
					</TR>
				</TBODY>
			</TABLE>
			<div id="search_div3"
				style="float;left;width:100%;height:90%;OVERFLOW-Y:scroll;display:none;scrollbar-face-color:#5094C0;scrollbar-shadow-color: #3D5054;
scrollbar-highlight-color: #C3D6DA;
scrollbar-3dlight-color: #3D5054;
scrollbar-darkshadow-color: #85989C;
scrollbar-track-color: #CCCCCC;
scrollbar-arrow-color: #FFFFFF">
				<TABLE cellSpacing="1" cellPadding="1" width="100%" border="0">
					<TR>
						<TD class=line>
							<table height="100%" cellSpacing=1 cellPadding=2 width="100%"
								bgColor=#CCCCCC border=0>
								<s:iterator value="xkList" id="bil" status="b">
									<tr bgColor=#FFFFFF>
										<td width="3%" align="center">
											<div id="xm<s:property value="id" />" style="cursor:pointer;"
												onclick="viewXmEmailByXkId('<s:property value="id" />','<s:property value="name" />')">
												＋
											</div>
										</td>
										<td width="16%" align="center">
											<font color="blue"><s:property value="name" />
											</font>
										</td>
										<td width="13%" align="center">
											--
										</td>
									</tr>
									<tr>
										<td colspan="3">
											<table width="100%" border="0" cellpadding="1"
												cellspacing="1" class="kuang"
												id="xk<s:property value="id" />" style="display:none;">
											</table>
										</td>
									</tr>
								</s:iterator>
								<tr bgColor=#FFFFFF>
									<td colspan="6">
										<input type="button" class="id_kuang" id="selectrEmailp"
											value="确认">
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</DIV>
	</body>
</html>
